<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>benchbox新增协程库性能基准测试</title>
    <meta name="description" content="简介Benchbox是一个基准测试包，基于tbox和xmake，里面包含许多针对第三方库功能的性能基准测试和对比，可以很方便的扩展测试用例和模块。目前内置：各大开源协程库性能基准测试，后续还会陆续增加各种开源库模块的分析测试测试报告仅供参考，测试代码或者结果上如有问题，可以提交issues编译请先安装: xmak...">

    
    <meta name="keywords" content="benchbox,tbox,协程,上下文切换,channel,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2016/10/28/benchbox-coroutine/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>benchbox新增协程库性能基准测试</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2016-10-28
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#benchbox" title="Category: benchbox" rel="category">benchbox</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#benchbox" title="Tag: benchbox" rel="tag">benchbox</a-->
        <a href="/cn/tag/#benchbox" title="Tag: benchbox" rel="tag">benchbox</a>&nbsp;
    
        <!--a href="/tag/#tbox" title="Tag: tbox" rel="tag">tbox</a-->
        <a href="/cn/tag/#tbox" title="Tag: tbox" rel="tag">tbox</a>&nbsp;
    
        <!--a href="/tag/#%E5%8D%8F%E7%A8%8B" title="Tag: 协程" rel="tag">协程</a-->
        <a href="/cn/tag/#协程" title="Tag: 协程" rel="tag">协程</a>&nbsp;
    
        <!--a href="/tag/#%E4%B8%8A%E4%B8%8B%E6%96%87%E5%88%87%E6%8D%A2" title="Tag: 上下文切换" rel="tag">上下文切换</a-->
        <a href="/cn/tag/#上下文切换" title="Tag: 上下文切换" rel="tag">上下文切换</a>&nbsp;
    
        <!--a href="/tag/#channel" title="Tag: channel" rel="tag">channel</a-->
        <a href="/cn/tag/#channel" title="Tag: channel" rel="tag">channel</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <h2 id="简介">简介</h2>

<p><a href="https://github.com/waruqi/benchbox">Benchbox</a>是一个基准测试包，基于<a href="https://github.com/waruqi/tbox">tbox</a>和<a href="http://xmake.io">xmake</a>，里面包含许多针对第三方库功能的性能基准测试和对比，可以很方便的扩展测试用例和模块。</p>

<p>目前内置：各大开源协程库性能基准测试，后续还会陆续增加各种开源库模块的分析测试</p>

<p>测试报告仅供参考，测试代码或者结果上如有问题，可以提交issues</p>

<h2 id="编译">编译</h2>

<p>请先安装: <a href="http://xmake.io">xmake</a></p>

<p>然后运行：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>    <span class="nv">$ </span>xmake
</code></pre>
</div>

<h2 id="协程切换测试报告2个协程">协程切换测试报告(2个协程)</h2>

<h4 id="run">Run</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake coroutine -n switch
</code></pre>
</div>

<h4 id="macosx-x86_64">Macosx (x86_64)</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 205 ms, 48780487 switches per second
boost:              10000000 switches in 728 ms, 13736263 switches per second
libmill:            10000000 switches in 525 ms, 19047619 switches per second
libtask:            10000000 switches in 1602 ms, 6242197 switches per second
golang:             10000000 switches in 1558 ms, 6418485 switches per second
</code></pre>
</div>

<h4 id="archlinux-i386--virtualbox">ArchLinux (i386) + VirtualBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 154 ms, 64935064 switches per second
boost:              10000000 switches in 485 ms, 20618556 switches per second
libmill:            10000000 switches in 689 ms, 14513788 switches per second
libtask:            10000000 switches in 4798 ms, 2084201 switches per second
libgo(boost):       10000000 switches in 1418 ms, 7052186 switches per second
libco:              10000000 switches in 774 ms, 12919896 switches per second
coroutine(cloudwu): 10000000 switches in 4983 ms, 2006823 switches per second
libfiber(acl):      10000000 switches in 863 ms, 11587485 switches per second
golang:             10000000 switches in 1239 ms, 8071025 switches per second
</code></pre>
</div>

<h4 id="linuxmint-x86_64--virtaulbox">LinuxMint (x86_64) + VirtaulBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 187 ms, 53475935 switches per second
boost:              10000000 switches in 199 ms, 50251256 switches per second
libmill:            10000000 switches in 145 ms, 68965517 switches per second
libtask:            10000000 switches in 5280 ms, 1893939 switches per second
libgo(boost):       10000000 switches in 1086 ms, 9208103 switches per second
libco:              10000000 switches in 687 ms, 14556040 switches per second
coroutine(cloudwu): 10000000 switches in 5181 ms, 1930129 switches per second
libfiber(acl):      10000000 switches in 342 ms, 29239766 switches per second
golang:             10000000 switches in 1200 ms, 8333333 switches per second
</code></pre>
</div>

<h2 id="协程切换测试报告1000个协程">协程切换测试报告(1000个协程)</h2>

<h4 id="run-1">Run</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake coroutine -n switch 1000
</code></pre>
</div>

<h4 id="macosx-x86_64-1">Macosx (x86_64)</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 438 ms, 22831050 switches per second
boost:              10000000 switches in 1949 ms, 5130836 switches per second
libmill:            10000000 switches in 1405 ms, 7117437 switches per second
libtask:            10000000 switches in 2272 ms, 4401408 switches per second
golang:             10000000 switches in 1512 ms, 6613756 switches per second
</code></pre>
</div>

<h4 id="archlinux-i386--virtualbox-1">ArchLinux (i386) + VirtualBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 295 ms, 33898305 switches per second
boost:              10000000 switches in 1021 ms, 9794319 switches per second
libmill:            10000000 switches in 2031 ms, 4923682 switches per second
libtask:            10000000 switches in 6369 ms, 1570105 switches per second
libgo(boost):       10000000 switches in 1853 ms, 5396654 switches per second
libco:              10000000 switches in 3328 ms, 3004807 switches per second
coroutine(cloudwu): 10000000 switches in 5082 ms, 1967729 switches per second
libfiber(acl):      10000000 switches in 1448 ms, 6906077 switches per second
golang:             10000000 switches in 1747 ms, 5724098 switches per second
</code></pre>
</div>

<h4 id="linuxmint-x86_64--virtaulbox-1">LinuxMint (x86_64) + VirtaulBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 switches in 400 ms, 25000000 switches per second
boost:              10000000 switches in 894 ms, 11185682 switches per second
libmill:            10000000 switches in 1014 ms, 9861932 switches per second
libtask:            10000000 switches in 6936 ms, 1441753 switches per second
libgo(boost):       10000000 switches in 1768 ms, 5656108 switches per second
libco:              10000000 switches in 2288 ms, 4370629 switches per second
coroutine(cloudwu): 10000000 switches in 5468 ms, 1828822 switches per second
libfiber(acl):      10000000 switches in 958 ms, 10438413 switches per second
golang:             10000000 switches in 1985 ms, 5037783 switches per second
</code></pre>
</div>

<h2 id="协程channel测试报告无buffer">协程channel测试报告（无buffer）</h2>

<h4 id="run-2">Run</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake coroutine -n channel
</code></pre>
</div>

<h4 id="macosx-x86_64-2">Macosx (x86_64)</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 916 ms, 10917030 passes per second
libmill:            10000000 passes in 3460 ms, 2890173 passes per second
libtask:            10000000 passes in 3646 ms, 2742731 passes per second
golang:             10000000 passes in 3180 ms, 3144654 passes per second
</code></pre>
</div>

<h4 id="archlinux-i386--virtualbox-2">ArchLinux (i386) + VirtualBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 2137 ms, 4679457 passes per second
libmill:            10000000 passes in 7859 ms, 1272426 passes per second
libtask:            10000000 passes in 18693 ms, 534959 passes per second
libgo(boost):       10000000 passes in 20063 ms, 498429 passes per second
libfiber(acl):      10000000 passes in 9496 ms, 1053074 passes per second
golang:             10000000 passes in 8781 ms, 1138822 passes per second
</code></pre>
</div>

<h4 id="linuxmint-x86_64--virtaulbox-2">LinuxMint (x86_64) + VirtaulBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 1702 ms, 5875440 passes per second
libmill:            10000000 passes in 2298 ms, 4351610 passes per second
libtask:            10000000 passes in 12894 ms, 775554 passes per second
libgo(boost):       10000000 passes in 11391 ms, 877886 passes per second
libfiber(acl):      10000000 passes in 4452 ms, 2246181 passes per second
golang:             10000000 passes in 5343 ms, 1871607 passes per second
</code></pre>
</div>

<h2 id="协程channel测试报告buffer大小10000">协程channel测试报告（buffer大小：10000）</h2>

<h4 id="run-3">Run</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake coroutine -n channel 10000
</code></pre>
</div>

<h4 id="macosx-x86_64-3">Macosx (x86_64)</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 404 ms, 24752475 passes per second
libmill:            10000000 passes in 4401 ms, 2272210 passes per second
libtask:            10000000 passes in 2785 ms, 3590664 passes per second
golang:             10000000 passes in 1135 ms, 8810572 passes per second
</code></pre>
</div>

<h4 id="archlinux-i386--virtualbox-3">ArchLinux (i386) + VirtualBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 212 ms, 47169811 passes per second
libmill:            10000000 passes in 3272 ms, 3056234 passes per second
libtask:            10000000 passes in 1624 ms, 6157635 passes per second
libgo(boost):       10000000 passes in 1720 ms, 5813953 passes per second
libfiber(acl):      10000000 passes in 1779 ms, 5621135 passes per second
golang:             10000000 passes in 768 ms, 13020833 passes per second
</code></pre>
</div>

<h4 id="linuxmint-x86_64--virtaulbox-3">LinuxMint (x86_64) + VirtaulBox</h4>

<div class="highlighter-rouge"><pre class="highlight"><code>tbox:               10000000 passes in 293 ms, 34129692 passes per second
libmill:            10000000 passes in 1135 ms, 8810572 passes per second
libtask:            10000000 passes in 1528 ms, 6544502 passes per second
libgo(boost):       10000000 passes in 1362 ms, 7342143 passes per second
libfiber(acl):      10000000 passes in 1510 ms, 6622516 passes per second
golang:             10000000 passes in 782 ms, 12787723 passes per second
</code></pre>
</div>

        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2016/10/28/benchbox-coroutine/">The benchmark reports of coroutine
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2016/10/26/api-scope/">xmake 描述语法和作用域详解</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2016/10/28/coroutine-context/">协程分析之context上下文切换</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
